package cn.frh.basic.config;

import cn.frh.user.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebConfig implements WebMvcConfigurer {

	@Autowired
	private LoginInterceptor loginInterceptor;

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(loginInterceptor).addPathPatterns("/**")
				//放行：跟登录，跟注册相关的，测试的 全部要排除
				.excludePathPatterns("/login/**")
				.excludePathPatterns("/user/register/**","/shop/settlement","/verifyCode/**","/fastDfs/**")
				.excludePathPatterns("/swagger-resources/**", "/webjars/**",
						"/v2/**", "/swagger-ui.html/**");
	}
}